
#ifndef __ENTITY_H__
#define __ENTITY_H__

#include "Defines.h"

struct sEntityDesc
{
	sEntityDesc()
	{
		ID = NULL;
		body = NULL;
		parent = NULL;
	}

	tID ID;
	tFilename spriteFilename;
	b2Body* body;
	CCNode* parent;
};

class cEntity
{
public:
	cEntity();
	virtual ~cEntity();

	virtual eEntityType::TYPE GetEntityType() const { return eEntityType::NONE; }
	void Init(const sEntityDesc& desc);
	virtual void Update(float dt);

	tID GetID() const { return m_ID; }
	b2Body* GetBody() const { return m_body; }
	tBool IsDeleted() const { return m_deleted; }

	void SetPosv(const CCPoint& posv);
	void SetPos(const CCPoint& pos);

	// events
	virtual void OnHit() {}

protected:
	tID m_ID;
	b2Body* m_body;
	CCSprite* m_sprite;
	CCNode* m_parent;

	tBool m_deleted;
};

#endif // __ENTITY_H__